package com.haoxuer.discover.area.rest.conver;

import com.haoxuer.discover.area.data.entity.Area;
import com.haoxuer.discover.area.rest.domain.response.simple.AreaSimple;
import com.haoxuer.discover.data.rest.core.Conver;

public class AreaSimpleConver implements Conver<AreaSimple, Area> {
  @Override
  public AreaSimple conver(Area source) {
    AreaSimple result = new AreaSimple();
    result.setId(source.getId());
    result.setPid(source.getParentId());
    result.setName(source.getName());
    if (source.getAreaType() != null) {
      result.setType(source.getAreaType().ordinal());
    }
    result.setCode(source.getCode());
    result.setLat(source.getLat());
    result.setLng(source.getLng());
    return result;
  }
}
